<?php /*a:2:{s:50:"F:\CaOadmin\application\admin\view\admin\role.html";i:1569485302;s:37:"../application/admin/view/layout.html";i:1569485205;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title><?php echo htmlentities($title); ?></title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico">
    <link href="<?php echo staticResource('css/bootstrap.min.css?v=3.3.6'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('css/font-awesome.min.css?v=4.4.0'); ?>" rel="stylesheet">
    
<link href="<?php echo staticResource('css/plugins/iCheck/custom.css'); ?>" rel="stylesheet">

    <link href="<?php echo staticResource('css/animate.css'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('css/style.css?v=4.1.0'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('extend/common.css'); ?>" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg">


<div class="wrapper wrapper-content animated fadeInRight">
  <div class="col-sm-12">
    <div class="ibox float-e-margins">
      <div class="ibox-content">
        <div class="row">
          <div class="col-sm-9 m-b-xs">

          </div>
          <div class="col-sm-3">
            <div class="input-group">
              <input type="text" placeholder="请输入关键词" class="form-control" id="key" value="<?php echo htmlentities($key); ?>">
              <span class="input-group-btn">
                <button type="button" class="btn btn-primary" onclick="search()"> 搜索</button>
              </span>
            </div>
          </div>
        </div>
        <div class="table-responsive">
          <div class="ibox float-e-margins">
            <div class="ibox-title">
              <button type="button" class="btn btn-primary" onclick="pop_iframe('添加角色',`<?php echo url('admin/role/add'); ?>`)"> 添加角色 </button>
              <button type="button" class="btn btn-danger" id="delete_more"> 批量删除 </button>
              <button type="button" class="btn btn-white" id="refresh-auth" onclick="refresh_auth()" style="float:right;"> 刷新系统权限 </button>
            </div>
            <div class="ibox-content">
              <table class="table table-hover">
                <thead>
                <tr>
                  <th><input type="checkbox" class="i-checks" id="check_all"></th>
                  <th>ID</th>
                  <th>角色名</th>
                  <th>状态</th>
                  <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <form id="check_ids" action="<?php echo url('admin/role/del'); ?>">
                  <?php foreach($data as $v): ?>
                  <tr>
                    <td>
                      <input type="checkbox" class="i-checks" value="<?php echo htmlentities($v['id']); ?>" name="id[]">
                    </td>
                    <td><?php echo htmlentities($v['id']); ?></td>
                    <td><?php echo htmlentities($v['name']); ?></td>
                    <td>
                      <div class="switch">
                        <div class="onoffswitch">
                          <input type="checkbox"  class="onoffswitch-checkbox" data-url="<?php echo url('admin/role/status'); ?>" data-id="<?php echo htmlentities($v['id']); ?>" id="sw-<?php echo htmlentities($v['id']); ?>" <?php if($v['status'] == 1): ?>checked<?php endif; ?>>
                          <label class="onoffswitch-label" for="sw-<?php echo htmlentities($v['id']); ?>">
                            <span class="onoffswitch-inner"></span>
                            <span class="onoffswitch-switch"></span>
                          </label>
                        </div>
                      </div>
                    </td>
                    <td>
                      <?php if($v['id'] != 1001): ?>
                      <a href="javascript:;" onclick="pop_iframe('编辑角色',`<?php echo url('admin/role/edit',['id' => $v['id']]); ?>`)" class="option-btn" title="编辑"><i class="glyphicon glyphicon-pencil text-navy"></i></a>
                      <a href="javascript:;" class="option-btn delete-one" title="删除" data-url="<?php echo url('admin/role/del'); ?>" data-id="<?php echo htmlentities($v['id']); ?>"><i class="glyphicon glyphicon-trash text-navy"></i></a>
                      <?php endif; ?>
                    </td>
                  </tr>
                  <?php endforeach; ?>
                </form>
                </tbody>
              </table>
            </div>
            <?php echo $data; ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>





<!-- 全局js -->
<script src="<?php echo staticResource('js/jquery.min.js?v=2.1.4'); ?>"></script>
<script src="<?php echo staticResource('js/bootstrap.min.js?v=3.3.6'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/metisMenu/jquery.metisMenu.js'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/slimscroll/jquery.slimscroll.min.js'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/layer/layer.min.js'); ?>"></script>
<script src="<?php echo staticResource('extend/common.js'); ?>"></script>

<!-- 自定义js -->

<!--选择框JS-->
<script src="<?php echo staticResource('js/plugins/iCheck/icheck.min.js'); ?>"></script>


<script>

    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });

    });

    // 搜索
    function search() {
        var key = $('#key').val();
        location.replace("<?php echo url('admin/role/list'); ?>" + '?key=' + key);
    }

    // 刷新系统权限
    function refresh_auth() {
        layer.confirm('刷新操作可能导致权限系统工作异常，请谨慎操作', {icon: 3, title:'提示'}, function(index) {
            http_post("<?php echo url('admin/role/refresh'); ?>", {}, function (res) {
                layer.msg('刷新成功', {icon: 1});
            });
            layer.close(index);
        });
    }
</script>


</body>

</html>
